import Vue from 'vue'
import App from './App.vue'
//引入路由对象
import router from './router/index.js'
import axios from '@/utils/request.js';

import { SwipeCell ,List,Button, Toast, Cell,NavBar,Icon,Uploader,Dialog,Field,ActionSheet,Tab, Tabs,PullRefresh  } from 'vant';

import '@/styles/index.less'
import '@/styles/reset.less'

Vue.use(Button);
Vue.use(Toast);
Vue.use(Cell);
Vue.use(NavBar);
Vue.use(Icon);
Vue.use(Uploader);
Vue.use(Dialog );
Vue.use(Field  );
Vue.use(ActionSheet);
Vue.use(Tab);
Vue.use(Tabs);
Vue.use(PullRefresh );
Vue.use(List  );
Vue.use(SwipeCell   );


//注册全局过滤器
Vue.filter('formdate',val => {
  if (!val) {
    return val
  }
  return val.toLocaleDateString()
})
  
//全局过滤器，判定url是否完整路径
Vue.filter('joinPath', val => {
  //val不存在
  if (!val) { return val }
  //如果val包括http
  if (val.indexOf('http') != -1) {
    return val
  }
  return axios.defaults.baseURL + val
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
